/**
 * @param {number[]} nums
 * @return {number}
 */
var findMaxConsecutiveOnes = function(nums) {
  let count = 0, result = 0;
  for(let i = 0; i < nums.length; i++) {
    if(nums[i]) {
      count++;
      result = Math.max(count, result);
    } else {
      count = 0;
    }
  }
  return result;
};
let nums = [1,1,0,1,1,1];
console.log(findMaxConsecutiveOnes(nums));
nums = [1,0,1,1,0,1];
console.log(findMaxConsecutiveOnes(nums));
